// priority queue header file
#ifndef _priorityqueue_H_
#define _priorityqueue_H_

class PQElement
{
public:
	PQElement();
	PQElement(void*,int);
	void* Object() { return object; }
	~PQElement();

private:
	friend class PriorityQueue;

	void* object;
	int key;
	int originalPosition;
};


class PriorityQueue
{
public:
	PriorityQueue();
	PriorityQueue(int);
	~PriorityQueue();
	void Add(void*,int);
	void Delete(int);
	void* Extract_Min();
	void* Minimum () { return queue[1].object; }
	void Change_Key(int,int);

private:
	PQElement* queue;
	int* position; //gives index of all items in the queue
	int numMembers;
	int totalSize;

	void HeapifyUp(int);
	void HeapifyDown(int);
};

#endif
